/**
 * RankingPair.java
 * ************************** 
 * @date May 5, 2011
 * @author Michele Tamburini
 * 
 * **************************
 */
package gossipServices.bootstraping.tman.rankingMethods;

import gossipServices.basic.nodeDescriptors.NodeDescriptor;

/**
 * Description: 
 * The input PartialView of a TManRankingMethod are packed into
 * pairs. Each pair contains the NodeDescriptor of the view 
 * and an Integer containing its ranking value.
 *
 */
public class RankingPair {

	protected NodeDescriptor node;
	protected Integer rank;
	
	public RankingPair(NodeDescriptor node, int rankValue){
		this.node = node;
		rank = new Integer(rankValue);
	}

	public final NodeDescriptor getNode() {
		return node;
	}

	public final Integer getRank() {
		return rank;
	}
	
	public void setRank(int value){
		rank = value;
	}
	
	public boolean equals(Object o){
		NodeDescriptor nodeO = ((RankingPair)o).getNode();
		return this.node.equals(nodeO);
	}
	
	public String toString(){
		String ret = new String("");
		ret += node.getNodeName();
		ret += " "+rank+"\n";
		return ret;
	}
	
}
